package com.iqiyi.game.ams.ui.dto;

import com.iqiyi.game.ams.infrastructure.app.ResponseEnum;
import lombok.Data;

/**
 * @author hanbaoyu
 */
@Data
public class ResponseDTO implements DTO {
    private Integer code;
    private String message;
    private Object data;

    public static ResponseDTO success(Object data) {
        ResponseDTO result = new ResponseDTO();
        result.setCode(ResponseEnum.OK.getCode());
        result.setMessage(ResponseEnum.OK.getMessage());
        result.setData(data);
        return result;
    }

    public static ResponseDTO error(Integer code, String message) {
        ResponseDTO result = new ResponseDTO();
        result.setCode(code);
        result.setMessage(message);
        return result;
    }

    public static ResponseDTO error(String message) {
        ResponseDTO result = new ResponseDTO();
        result.setCode(ResponseEnum.ERROR.getCode());
        result.setMessage(message);
        return result;
    }

}
